package com.chub.study.service;

import com.chub.study.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author : chub
 * @version : V1.0.0
 * @fileName : UserRepository.java
 * @description : TODO
 * @createTime : 2021-12-14 18:53
 */
public interface UserRepository extends JpaRepository<User, Long> {

    User findByName(String name);

    User findByNameAndAge(String name, Integer age);

    @Query("from User u where u.name=:name")
    User findUser(@Param("name") String name);

}
